<template>
  <div>
    <h2>修 改 事 件 信 息</h2>
    <div class="info">
      <div class="left">
        <p>事件名称：{{ thing.thingName }}</p>
        <p>时间：{{ thing.thingDate }}</p>

        <p>
          灾情阶段：<el-select v-model="value" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.label"
            >
            </el-option>
          </el-select>
        </p>
        <p>灾情描述：{{ thing.thingDescription }}</p>
        <p>灾害类型：{{ thing.thingType }}</p>
        <p>初步损失：{{ thing.thingLoss }}</p>
        <p>专家建议：{{ thing.advice }}</p>
      </div>
      <div class="right">
        <span>灾区图片</span>
        <img :src="/api/ + thing.thingPic" alt="未找到" /> <br /><br /><br />
        <p>发现途径：{{ thing.thingChannel }}</p>
        <p>发生位置：{{ thing.areaName }}</p>
        <p>所在小班：{{ thing.className }}</p>
        <p>影响面积：{{ thing.thingArea }}</p>
        <p>防治方案：<input type="text" v-model="thing.thingScheme" /></p>
      </div>
    </div>
    <el-row>
      <el-button plain @click="update()">修改</el-button>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      thingId: "",
      thing: "",
      options: [
        {
          value: "选项1",
          label: "已经得到控制",
        },
        {
          value: "选项2",
          label: "防治中",
        },
        {
          value: "选项3",
          label: "无法解决，申请专家会商",
        },
      ],
      value: "",
    };
  },
  methods: {
    async getThingInfo(thingId) {
      let paramObj = { thingId: thingId };
      let info = await this.ajax.getSubmit("/api/thing/get", paramObj);
      //console.log(info);
      this.thing = info;
    },
    back() {
      this.$router.push("/home/classes");
    },
    async update() {
      let paramObj = {
        thingId: this.thingId,
        thingStage: this.value,
        thingScheme: this.thing.thingScheme,
      };
      let info = await this.ajax.getSubmit("/api/thing/update", paramObj);
      console.log(info);
    },
  },
  created() {
    //console.log(this.$route.query.diseaseId);
    this.thingId = this.$route.query.thingId;
    this.getThingInfo(this.thingId);
  },
};
</script>

<style>
</style>